import {ref,reactive} from 'vue'
import {defineStore} from 'pinia'
import { teamMembersListGet, teamMembersPageGet} from '@/api/teamMembersApi.js';

export const useTeamMembersStore = defineStore('teamMembers', () => {

const teamMembersPage = ref([])
const teamMembersList = ref([])
const pagination = reactive({
    current:1,
    total:0
})

async function getTeamMembersPage(query = {}) {
let {records, current, total} =await teamMembersPageGet(query)
teamMembersPage.value = records
pagination.current = current
pagination.total = total
}

async function getTeamMembersList(query = {}) {
teamMembersList.value = await teamMembersListGet(query)
}


return {
pagination,
teamMembersPage, getTeamMembersPage,getTeamMembersList}
})
